package com.hcxdi.api.bean.auth;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 登陆授权请求对象
 * @author 成都青桔科技有限公司
 * @version 1.0
 * @changelog 16-10-31 初始化
 */
public class AuthReq implements Parcelable {
    /**
     * 11位手机号码
     */
    private String phone;
    /**
     * 验证短信
     */
    private String code;
    /**
     * 登陆客户端类型
     */
    private Integer clientType;
    /**
     * 验证短信类型
     */
    private Integer type;
    /*jsonObject.put("phone", phone);
    jsonObject.put("code", code);
    jsonObject.put("clientType", 1);
    jsonObject.put("type", Code.CODE_TYPE_LOGIN);*/

    /**
     * 登陆请求对象
     * @param phone 11位手机号码
     * @param code 验证短信
     * @param clientType 登陆客户端类型
     * @param type 验证短信类型
     */
    public AuthReq(String phone, String code, Integer clientType, Integer type) {
        this.phone = phone;
        this.code = code;
        this.clientType = clientType;
        this.type = type;
    }

    public enum  ClientType{
        android
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Integer getClientType() {
        return clientType;
    }

    public void setClientType(Integer clientType) {
        this.clientType = clientType;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.phone);
        dest.writeString(this.code);
        dest.writeValue(this.clientType);
        dest.writeValue(this.type);
    }

    public AuthReq() {
    }

    protected AuthReq(Parcel in) {
        this.phone = in.readString();
        this.code = in.readString();
        this.clientType = (Integer) in.readValue(Integer.class.getClassLoader());
        this.type = (Integer) in.readValue(Integer.class.getClassLoader());
    }

    public static final Creator<AuthReq> CREATOR = new Creator<AuthReq>() {
        @Override
        public AuthReq createFromParcel(Parcel source) {
            return new AuthReq(source);
        }

        @Override
        public AuthReq[] newArray(int size) {
            return new AuthReq[size];
        }
    };
}
